package com.bingqing.service;

import com.bingqing.dao.NoticeDao;
import com.bingqing.dao.ReserveDao;
import com.bingqing.entity.Notice;
import com.bingqing.entity.Params;
import com.bingqing.entity.Reserve;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * ClassName: TypeService
 * Package: com.bingqing.service
 * Description:
 *
 * @Author liuyujie
 * @Create 2024-03-10 9:23
 * @Version 1.0
 */
@Service
public class NoticeService {
    @Resource
    NoticeDao noticeDao;


    //分页查询
    public PageInfo<Notice> findBySearch(Params params) {
        PageHelper.startPage(params.getPageNum(),params.getPageSize());
        List<Notice> list=  noticeDao.findBySearch(params);
        return PageInfo.of(list);
    }
    //查询所有


    public void add(Notice notice) {
        noticeDao.insertSelective(notice);
    }


    public void deleteById(Integer id) {
        noticeDao.deleteByPrimaryKey(id);
    }

    public void update(Notice notice) {
        noticeDao.updateByPrimaryKeySelective(notice);
    }

    public List<Notice> findAll() {
        return noticeDao.selectAll();
    }
}
